import AppIMDelegate from "./delegate/app-im-delegate";

App({
  onLaunch: function (options) {
    try {
      this.globalData.logininfo = wx.getStorageSync('logininfo');
        //this.globalData.openid = wx.getStorageSync('openid');
      //console.log(this.globalData.userInfo);
    } catch (e) {
      console.log(e);
    }

    this.appIMDelegate = new AppIMDelegate(this);
    this.appIMDelegate.onLaunch(options);

    var system = {};
    if (options.scene == 1007 || options.scene == 1008) {
      system.isShare = true;
    } else {
      system.isShare = false;
    };
    this.globalData.system = system;
  },
  getIMHandler() {
    return this.appIMDelegate.getIMHandlerDelegate();
  },
  onHide() {
    this.appIMDelegate.onHide();
  },
  onShow(options) {
    //this.onCreateWebsocket(options);
  },
  onCreateWebsocket(options) {
    this.appIMDelegate.onShow(options);
  },
  globalData: {
    logininfo: {
      userInfo: {
        nickName: '点击登录',
        //avatarUrl: 'http://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png',
        avatarUrl: '/static/images/my/user.png',
        openid: '',
      }
    },
  },
  //跳转时需要的参数
  switchData:'',
  //行程随笔图片数据
  journey: { "imageList": [], "coverIndex": 0, "selectAllLable": [], "selectLableTextArray": [], "intro": '', "addr": "", "addrLatitude": "", "addrLongitude": "", "address": "","privacy":false},
  // 下拉刷新
  onPullDownRefresh: function () {
      // 显示顶部刷新图标
      wx.showNavigationBarLoading();

      var that = this;
      
      // 隐藏导航栏加载框
      wx.hideNavigationBarLoading();
      // 停止下拉动作
      wx.stopPullDownRefresh();
  }
})